﻿//Copyright (C) <2013>  <jonathan cleeve norton> All Rights Reserved 
//Contact jon.norton@fin-plus.co.uk website <http://www.fin-plus.co.uk/>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Media;
using System.Windows.Controls;
using System.Reflection;
using FinPlusInterfaces;

namespace FinPlusCompView
{
    public partial class FinPlusStatusBar : FinPlusControl
    {
        [State(Test = true)]
        public override bool IsValid { get; set; }

        //construct
        public FinPlusStatusBar()
        {
            InitializeComponent();

            version.Text = string.Format("Version {0}", Assembly.GetExecutingAssembly().GetName().Version);
            user.Text = string.Format("{0}", Environment.UserName);
            tiering.Text = string.Format("Render tier {0}", RenderCapability.Tier >> 16);
            IsValid = true;
        }

        public void Update(DataGrid dataGrid)
        {
            var total = 0.0;
            var cells = dataGrid.SelectedCells;
            foreach (var item in cells)
                if (item != null)
                    total += item.GetValue();

            this.total.Text = string.Format("Rows={0} Count={1} Σ={2}, μ={3}", dataGrid.Items.Count, cells.Count, total.ToString("#,##0.######;-#,##0.######"), (total / cells.Count).ToString("#,##0.######;-#,##0.######"));
        }
    }
}














































































































































































//Copyright2013<jnrton>AllRightsReserved 
//Contact j.nrton@finpus